package seminar.evaluate;

import java.util.HashSet;
import java.util.Set;

import seminar.Semester;

/**
 * Evaluator for semester time tables
 * @author Johannes Degler
 *
 */
public class Evaluator {

	private static final Set<IEvaluator> EVALUATORS = new HashSet<IEvaluator>();

	static{
		Evaluator.EVALUATORS.add(new BreaksEvaluator());
		Evaluator.EVALUATORS.add(new StartAndEndEvaluator());
		Evaluator.EVALUATORS.add(new LecturesPerDayEvaluator());
		Evaluator.EVALUATORS.add(new RoomChangeEvaluator());
		Evaluator.EVALUATORS.add(new MorningOrNoonFreeEvaluator());
	}

	private final Semester semester;

	/**
	 * New evaluator
	 * @param semester Semester to evaluate
	 */
	public Evaluator(final Semester semester) {
		this.semester = semester;
	}

	/**
	 * Start evaluation
	 */
	public void evaluate(){
		int points = 0;

		for(final IEvaluator ev : Evaluator.EVALUATORS)
			points += ev.getPoints(this.semester);

		this.semester.setPoints(points);
	}

}
